package com.itheima.demo5tcp2;

import java.io.DataInputStream;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
//服务端
public class ServerDemo2 {
    public static void main(String[] args) throws Exception {
        //创建一个服务器
        ServerSocket ss = new ServerSocket(10086);
        //调用accept方法 阻塞
        while (true) {
            Socket socket = ss.accept();
            System.out.println("一个客户端连接了"+socket.getInetAddress().getHostAddress());
            //创建一个线程
            ServerReader s1=new ServerReader(socket);
            s1.start();
        }
    }
}
